//import java.util.Scanner;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ken
 * Date: 2023-11-03
 * Time: 18:49
 */
class Dog {
    int age;
    String name;
    static {
        System.out.println("构造代码块 ，它先于别的任何代码块");
    }
    {
        System.out.println("实例代码块，实例代码块会先于构造代码块输出");
    }
    public Dog() {
        this(10,"坦克");
        System.out.println("这是构造函数"+age+"年龄"+"姓名"+name);
    }
    public Dog(int a,String b) {
     age = a;
     name = b;
    }

}
public class Test2 {
    public int aMethod(){
         int i = 0;
        i++;
        return i;
    }

}
public class Test {

        private float f=1.0f;

        int m=12;

        static int n=1;

        public static void main(String args[]){

            Test t=new Test();
            this.m = 55;
            System.out.print(m);
        }


    public static void main12(String args[]){
        Test2 test = new Test2();
        //test.aMethod();
        int j = test.aMethod();
        System.out.println(j);
    }
    public static void main11(String[] args) {



        Dog dog = new Dog();
    }
    public static void  toString (int[] x) {
        System.out.print("[");
        for(int i = 0;i < x.length;i++) {
            System.out.print(x[i]);
            if(i<x.length-1) {
                System.out.print(", ");
            }
        }
        System.out.print("]   这是我自己的");
    }

    public static void main10(String[] args) {
        int[] arry = {1,2,3,4,5,6};
        System.out.println(Arrays.toString(arry));
        toString(arry);

    }

    public static void  copyOf(int[] x , int[] y){
        for(int i = 0;i < x.length;i++) {
            y[i] = x[i];
        }
    }
    public static void main9(String[] args) {
        int[] arry = {1,2,4,6,22,11,221};
        int[] arry2 = new int[7];
        copyOf(arry,arry2);
        System.out.println(Arrays.toString(arry));
        System.out.println(Arrays.toString(arry2));
    }
    public static int Binarysearch (int[] x, int n) {
        int left = 0;
        int right = x.length-1;
        int mid = (left + right) / 2;
        while(left < right) {
            if(x[mid] > n) {
                right = mid;
                mid = (left + right) / 2;
            }
            if(x[mid] < n) {
                left = mid;
                mid = (left + right) / 2;
            }
            if(x[mid] == n) {
                break;
            }
        }
        return mid;
    }
    public static void main8(String[] args) {  //输入想要找的数字，然后输出相应的下标
        int[] arry = {1,2,3,4,5,6,7,8,9,10};
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int ret = Binarysearch(arry,n);
        System.out.println(ret);
    }
    public static void Sort(int[] x) {
        for(int i = 0;i < x.length-1;i++) {
            if(x[i] > x[i+1]) {
                System.out.println("不是顺序排列");
                break;
            }
        }
    }
    public static void main7(String[] args) {
        int[] arry = {1,2,3,5,4};
        Sort(arry);
    }
    public static void Bubble (int[] x) {
        for(int i = 0;i < x.length-1;i++) {
            for(int j = i + 1;j < x.length;j++) {
                if(x[i] > x[j]) {
                    int temp = x[i];
                    x[i] = x[j];
                    x[j] = temp;
                }
            }
        }
    }
    public static void main6(String[] args) {
        int[] arry = new int[]{5,2,7,1,9};
        Bubble(arry);
        System.out.printf( Arrays.toString(arry));
    }
    public static void Array(int[] x) {
        for(int i = 0;i < x.length;i++) {
            x[i] = i+1;
            System.out.print(x[i]+" ");
        }
    }
    public static void main5(String[] args) {
        int[] arry = new int[100];
        Array(arry);
    }
    public static int qingwa(int x) {
        if(x == 1 || x == 0) {
            return 1;
        }
        return qingwa(x - 1)+qingwa(x - 2);
    }
    public static void main4(String[] args) {
        //Scanner input = new Scanner(System.in);
        //int n = input.nextInt();
        //int ret = qingwa(n);
        System.out.println(qingwa(0));
        System.out.println(qingwa(1));
        System.out.println(qingwa(2));
        System.out.println(qingwa(3));
        System.out.println(qingwa(4));
        System.out.println(qingwa(5));


    }
    public static void hanota(int x , char a,char b,char c) {
        if(x==1) {
            move(a,c);
            return;
        }
        hanota(x-1,a,c,b);
        move(a,c);
        hanota(x-1,b,a,c);
    }
    public static void move(char a,char b) {
        System.out.print(a+"->"+b+"  ");
    }
    public static void main2(String[] args) {
        hanota(1,'A','B','C');
        System.out.println();
        hanota(2,'A','B','C');
        System.out.println();
        hanota(3,'A','B','C');

    }
//    public static void digui(int x) {
//        if(x <= 9) {
//            System.out.print(x+" ");
//            return;
//        }
//        digui(x / 10);
//        System.out.print(x % 10+" ");
//    }
//    public static void main1(String[] args) {
//        Scanner input = new Scanner(System.in);
//        int n = input.nextInt();
//        digui(n);
//    }
}
